﻿<UserControl x:Class="Kokomo.PeInspector.Reflection.AssemblyListView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
			 xmlns:kui="xaml://kokomo/ui"
			 xmlns:env="xaml://kokomo/environment"
			 xmlns:pe="clr-namespace:Kokomo.PeInspector"
			 xmlns:r="clr-namespace:Kokomo.PeInspector.Reflection"
			 xmlns:com="clr-namespace:System.ComponentModel;assembly=WindowsBase"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
	<FrameworkElement.Resources>
		<BitmapImage x:Key="TypeTreeImageSource" UriSource="../images/class.png"/>
		<BitmapImage x:Key="SearchImageSource" UriSource="../images/search.png"/>
		<BitmapImage x:Key="FavoritesImageSource" UriSource="../images/favorites.png"/>

		<CollectionViewSource x:Key="AssemblyCollectionView" Source="{Binding AssemblyNodes}">
			<CollectionViewSource.SortDescriptions>
				<com:SortDescription PropertyName="Heading"/>
			</CollectionViewSource.SortDescriptions>
		</CollectionViewSource>

	</FrameworkElement.Resources>
	<env:NavigationView
		GoBackCommand="{Binding GoBackCommand}"
		GoForwardCommand="{Binding GoForwardCommand}"
		>
		<Grid>
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="300"/>
				<ColumnDefinition Width="*"/>
			</Grid.ColumnDefinitions>

			<TabControl
					Margin="0 0 6 0"
					>
				<TabItem>
					<TabItem.Header>
						<StackPanel Orientation="Horizontal">
							<Image Source="{StaticResource TypeTreeImageSource}" Width="16" Height="16"/>
							<TextBlock Text="Type Tree"/>
						</StackPanel>
					</TabItem.Header>
					<kui:EnhancedTreeView
							SelectedObject="{Binding SelectedAssemblyNode}"
							ItemsSource="{Binding Source={StaticResource AssemblyCollectionView}}"
							ItemContainerStyle="{DynamicResource {x:Static env:EditorStyleKeys.TreeNodeStyleKey}}"
							TextSearch.TextPath="Heading"
							>
						<TreeView.InputBindings>
							<KeyBinding Key="Delete" Command="{Binding RemoveAssemblyCommand}" CommandParameter="{Binding SelectedAssemblyNode}"/>
						</TreeView.InputBindings>
					</kui:EnhancedTreeView>
				</TabItem>
				<TabItem>
					<TabItem.Header>
						<StackPanel Orientation="Horizontal">
							<Image Source="{StaticResource SearchImageSource}" Width="16" Height="16"/>
							<TextBlock Text="Search"/>
						</StackPanel>
					</TabItem.Header>
					<r:AssemblyListSearchView DataContext="{Binding Search}"/>
				</TabItem>
				<TabItem>
					<TabItem.Header>
						<StackPanel Orientation="Horizontal">
							<Image Source="{StaticResource FavoritesImageSource}" Width="16" Height="16"/>
							<TextBlock Text="Favorites"/>
						</StackPanel>
					</TabItem.Header>
					<ListBox
						ItemsSource="{Binding Favorites}"
						TextSearch.TextPath="Heading"
						kui:ListViewHelper.IsSortingEnabled="True"
						kui:ListViewHelper.ItemActivatedCommand="{Binding NavigateToCommand}"
						>
						<ListBox.ItemContainerStyle>
							<Style>
								<Setter Property="kui:ListViewHelper.ItemParameter" Value="{Binding Target}"/>
							</Style>
						</ListBox.ItemContainerStyle>
					</ListBox>
				</TabItem>
			</TabControl>
			<GridSplitter Width="6" Background="Transparent"/>

			<env:DetailView Grid.Column="1" DataContext="{Binding CurrentDetailViewModel}"/>
		</Grid>
	</env:NavigationView>
</UserControl>
